<?php

class ApiController extends BaseController {
        
    public function indexAction($requestData) {
		echo 'PEAK API v1.0';
		exit;
    }
    
    public function loginAction($requestData) {
    	if($_SERVER['REQUEST_METHOD'] == 'POST') {
	    	$login = isset($requestData['login']) ? $requestData['login'] : "";
	    	$password = isset($requestData['password']) ? $requestData['password'] : "";
	    	$website = isset($requestData['website']) ? $requestData['website'] : "";
	    	$member = Member::get($login, "login");
	    	if($member->id > 0) {
    			if($member->password == $password) {
    				return $this->result($member->id);
    			} else {
    				
    			}
	    	} else {
	    		
	    	}
    	} else {
    		header('Content-type: text/plain');
	    	echo "Usage: /api/login/\n";
	    	echo "Required: login, password hash, website\n";
    	}
    	exit;
    }
    
    private function result($output) {
    	
    }

}

?>